package com.example.pattern.adapter;

/**
 * 通过构造器或者设置属性的方式都可以把ThreePlug对象传入对象适配器中
 */
public class ObjectAdapter implements TwoPlugIF {

    public ObjectAdapter(ThreePlug threePlug){
        this.threePlug = threePlug;
    }

    private ThreePlug threePlug;

    public ThreePlug getThreePlug() {
        return threePlug;
    }

    public void setThreePlug(ThreePlug threePlug) {
        this.threePlug = threePlug;
    }

    @Override
    public void powerWithTwoPlug() {
        threePlug.powerWithThreePlug();
        System.out.println("已经改造为两孔供电");
    }
}
